package models_main

import (
	"fmt"
	"longmen/server/pkg/db/mysql/models"
	"time"
)

type GroupChat struct {
	Id            int       //自增id
	CreatedAt     time.Time //创建时间
	FansGroupId   string    //im群id
	Name          string    //群名称
	Avatar        string    //群头像
	Introduce     string    //群介绍
	WelcomeDesc   string    //欢迎语
	AnchorId      int       //主播id
	CreateAdminId int       //创建者管理员id
	Status        int       //0-正常 1-解散
	UserNum       int       //群用户数量
}

func (GroupChat) TableName() string {
	return fmt.Sprintf("%sgroup_chat", models.Prefix)
}

const (
	GroupChatStatusNormal = iota
	GroupChatStatusDissolve
)
const (
	GroupChatLimitNum = 500
)

type GroupChatUser struct {
	Id          int       //自增id
	CreatedAt   time.Time //创建时间
	GroupId     int       //群id
	FansGroupId string    //im群id
	UserId      int       //用户id
	Role        int       //角色 0-群员 1-管理 2-群主 3-机器人
	Status      int       //0-正常
}

func (GroupChatUser) TableName() string {
	return fmt.Sprintf("%sgroup_chat_user", models.Prefix)
}

const (
	GroupChatRoleMember = iota
	GroupChatRoleAdmin
	GroupChatRoleMaster
)

const (
	GroupChatUserStatusCommon = iota
	GroupChatUserStatusBan
)

type GroupChatDelete struct {
	Id          int    //自增id
	CreateStamp int64  //操作时间-毫秒
	UserId      int    //操作人id
	GroupId     int    //群聊id
	FansGroupId string //im群id
}

func (GroupChatDelete) TableName() string {
	return fmt.Sprintf("%sgroup_chat_delete", models.Prefix)
}
